<?php
require_once 'libraries/functions.php';

$path = "../ptnhuan-web1/data/films.txt";
$full_path = realpath($path);
$films = mreadFile($path);
?>

<?php foreach ($films as $item): ?>
    <?php
    $film = explode(";", $item);
    $item = trim($item);
    if (!empty($item)):
        ?>
        <?php if ($film[0]): ?>
            <?php if (isset($film[0]) || isset($film[2]) || isset($film[3])): ?>
                <?php echo $film[0] ?>
                <img src = '../ptnhuan-web1/public/images/films/<?php echo $film[1] ?>'> 
                <?php echo $film[2] ?>
                <?php echo $film[3] ?>
                <br>
            <?php endif; ?>
        <?php endif; ?>
    <?php endif; ?>             
<?php endforeach; ?>   